package com.whmnx.chitchat.main;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.WindowManager;
import android.view.animation.AlphaAnimation;
import android.widget.LinearLayout;


import com.tencent.imsdk.TIMCallBack;
import com.tencent.imsdk.TIMManager;
import com.tencent.qcloud.tim.uikit.TUIKit;
import com.tencent.qcloud.tim.uikit.base.IUIKitCallBack;
import com.whmnx.chitchat.R;
import com.whmnx.chitchat.base.BaseApplication;
import com.whmnx.chitchat.constants.Constants;
import com.whmnx.chitchat.utils.SPUtil;


/**
 * @author Administrator
 */
public class LaunchActivity extends Activity {
    private LinearLayout llRootView;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.tab_01);
        BaseApplication.getInstance().addActvity(this);
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
        llRootView = findViewById(R.id.ll_root_view);
        AlphaAnimation animation = new AlphaAnimation(0.3f, 1.0f);
        animation.setDuration(1500);
        llRootView.startAnimation(animation);
        loadData();
    }

    protected void loadData() {
        //耗时任务，比如加载网络数据
        getCircleData();
        //结束当前的 Activity
        llRootView.postDelayed(() -> {
            if (SPUtil.getBoolean(Constants.WELCOME)) {
                Intent intent = new Intent(LaunchActivity.this, MainActivity.class);
                startActivity(intent);
            }else {
                Intent intent = new Intent(LaunchActivity.this, WelcomeActivity.class);
                startActivity(intent);
                finish();
            }
        }, 1000);
    }

    private void getCircleData() {

    }
}
